<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$basic = $this->plugin_setting('basic');
if($_RQ['op']=='main'){
	set_html('title',$basic['title']?'直播列表-'.$basic['title']:'直播列表');
	$return['sharedata']=array(
		'title'=>$basic['share_title'],
		'desc'=>$basic['share_desc'],
		'link'=>custom_url('jy_yiliao/zhibo/',true),
		'imgUrl'=>ATTACHMENT_URL.$basic['share_image'],
	);
	$return['params']=array('type'=>0,'keyword'=>'');
	if($_RQ['keyword']){
		$return['params']['keyword']=$_RQ['keyword'];
	}
	exi($return);
}
if($_RQ['op']=='getlist'){
	$post=get_postdata();
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
	//排序医生
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$return['status']=0;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'fields'=>$fields,
		'orderby'=>$orderby,
	);
	$list=pdo_getslice('jy_yiliao_zhibo',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$sum=0;
	if($list){
		$sum=count($list);
		foreach($list as &$item){
			$item['starttime']=date('Y-m-d H:i:s',$item['starttime']);
			$item['endtime']=date('Y-m-d H:i:s',$item['endtime']);
			$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
			$item['workertitle']=pdo_getcolumn('jy_yiliao_worker',array('id'=>$item['workerid']),'name');
			$item['url']=$item['liveurl'];
		}
	}
	$return['list']=$list;
	exi($return);
}